using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Attributes;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Attributes.DomainAttributes;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Enums;
using System.Collections.Generic;
using System.ComponentModel;

namespace Baci.ArcGIS._DataManagementTools._GeodatabaseAdministration
{
    /// <summary>
    /// <para>Create Enterprise Geodatabase</para>
    /// <para>Creates a database, storage locations, and a database user to act as the geodatabase administrator and owner of the geodatabase. Functionality varies depending on the database management system used. The tool grants the geodatabase administrator the privileges required to create a geodatabase; it then creates a geodatabase in the database.</para>
    /// <para>创建数据库、存储位置和数据库用户，以充当地理数据库的管理员和所有者。功能因所使用的数据库管理系统而异。该工具可授予地理数据库管理员创建地理数据库所需的权限;然后，它会在数据库中创建一个地理数据库。</para>
    /// </summary>    
    [DisplayName("Create Enterprise Geodatabase")]
    public class CreateEnterpriseGeodatabase : AbstractGPProcess
    {
        /// <summary>
        /// 无参构造
        /// </summary>
        public CreateEnterpriseGeodatabase()
        {

        }

        /// <summary>
        /// 有参构造
        /// </summary>
        /// <param name="_database_platform">
        /// <para>Database Platform</para>
        /// <para><xdoc>
        ///   <para>Specifies the type of database management system to which a connection will be made to create a geodatabase.</para>
        ///   <bulletList>
        ///     <bullet_item>Oracle—Connect to an Oracle instance.</bullet_item><para/>
        ///     <bullet_item>PostgreSQL—Connect to a PostgreSQL database cluster.</bullet_item><para/>
        ///     <bullet_item>SQL Server— Connect to a Microsoft SQL Server instance.</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>指定将连接到以创建地理数据库的数据库管理系统类型。</para>
        ///   <bulletList>
        ///     <bullet_item>Oracle - 连接到 Oracle 实例。</bullet_item><para/>
        ///     <bullet_item>PostgreSQL - 连接到 PostgreSQL 数据库集群。</bullet_item><para/>
        ///     <bullet_item>SQL Server - 连接到 Microsoft SQL Server 实例。</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// </param>
        /// <param name="_instance_name">
        /// <para>Instance</para>
        /// <para><xdoc>
        ///   <para>The name of the instance.</para>
        ///   <para>For SQL Server, provide the SQL Server instance name. Case-sensitive or binary collation SQL Server instances are not supported.</para>
        ///   <para>For Oracle, provide either the TNS name or the Oracle Easy Connection string.</para>
        ///   <para>For PostgreSQL, provide the name of the server where PostgreSQL is installed.</para>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>实例的名称。</para>
        ///   <para>对于 SQL Server，请提供 SQL Server 实例名称。不支持区分大小写或二进制排序规则的 SQL Server 实例。</para>
        ///   <para>对于 Oracle，请提供 TNS 名称或 Oracle Easy Connection 字符串。</para>
        ///   <para>对于 PostgreSQL，请提供安装 PostgreSQL 的服务器的名称。</para>
        /// </xdoc></para>
        /// </param>
        /// <param name="_authorization_file">
        /// <para>Authorization File</para>
        /// <para><xdoc>
        ///   <para>The path and file name of the keycodes file that was created when ArcGIS Server was authorized. This file is in the \\Program Files\ESRI\License<release#>\sysgen folder on Windows or the /arcgis/server/framework/runtime/.wine/drive_c/Program Files/ESRI/License<release#>/sysgen directory on Linux. If you have not already done so, authorize ArcGIS Server to create this file.</para>
        ///   <para>You will likely need to copy the keycodes file from the ArcGIS Server machine to a location accessible to the tool.</para>
        /// </xdoc></para>
        /// <para><xdoc>
        /// <para>授权 ArcGIS Server 时创建的密钥代码文件的路径和文件名。此文件位于 Windows 的 \\Program Files\ESRI\License<release#>\sysgen 文件夹中，或者位于 Linux 上的 /arcgis/server/framework/runtime/.wine/drive_c/Program Files/ESRI/License<release#>/sysgen 目录中。如果尚未执行此操作，请授权 ArcGIS Server 创建此文件。</para>
        ///   <para>您可能需要将密钥代码文件从 ArcGIS Server 计算机复制到该工具可访问的位置。</para>
        /// </xdoc></para>
        /// </param>
        public CreateEnterpriseGeodatabase(_database_platform_value _database_platform, object _instance_name, object _authorization_file)
        {
            this._database_platform = _database_platform;
            this._instance_name = _instance_name;
            this._authorization_file = _authorization_file;
        }
        public override string ToolboxName => "Data Management Tools";

        public override string ToolName => "Create Enterprise Geodatabase";

        public override string CallName => "management.CreateEnterpriseGeodatabase";

        public override List<string> AcceptEnvironments => [];

        public override object[] ParameterInfo => [_database_platform.GetGPValue(), _instance_name, _database_name, _account_authentication.GetGPValue(), _database_admin, _database_admin_password, _sde_schema.GetGPValue(), _gdb_admin_name, _gdb_admin_password, _tablespace_name, _authorization_file, _out_result];

        /// <summary>
        /// <para>Database Platform</para>
        /// <para><xdoc>
        ///   <para>Specifies the type of database management system to which a connection will be made to create a geodatabase.</para>
        ///   <bulletList>
        ///     <bullet_item>Oracle—Connect to an Oracle instance.</bullet_item><para/>
        ///     <bullet_item>PostgreSQL—Connect to a PostgreSQL database cluster.</bullet_item><para/>
        ///     <bullet_item>SQL Server— Connect to a Microsoft SQL Server instance.</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>指定将连接到以创建地理数据库的数据库管理系统类型。</para>
        ///   <bulletList>
        ///     <bullet_item>Oracle - 连接到 Oracle 实例。</bullet_item><para/>
        ///     <bullet_item>PostgreSQL - 连接到 PostgreSQL 数据库集群。</bullet_item><para/>
        ///     <bullet_item>SQL Server - 连接到 Microsoft SQL Server 实例。</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Database Platform")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public _database_platform_value _database_platform { get; set; }

        public enum _database_platform_value
        {
            /// <summary>
            /// <para>SQL Server</para>
            /// <para>SQL Server— Connect to a Microsoft SQL Server instance.</para>
            /// <para>SQL Server - 连接到 Microsoft SQL Server 实例。</para>
            /// </summary>
            [Description("SQL Server")]
            [GPEnumValue("SQL_Server")]
            _SQL_Server,

            /// <summary>
            /// <para>PostgreSQL</para>
            /// <para>PostgreSQL—Connect to a PostgreSQL database cluster.</para>
            /// <para>PostgreSQL - 连接到 PostgreSQL 数据库集群。</para>
            /// </summary>
            [Description("PostgreSQL")]
            [GPEnumValue("PostgreSQL")]
            _PostgreSQL,

            /// <summary>
            /// <para>Oracle</para>
            /// <para>Oracle—Connect to an Oracle instance.</para>
            /// <para>Oracle - 连接到 Oracle 实例。</para>
            /// </summary>
            [Description("Oracle")]
            [GPEnumValue("Oracle")]
            _Oracle,

        }

        /// <summary>
        /// <para>Instance</para>
        /// <para><xdoc>
        ///   <para>The name of the instance.</para>
        ///   <para>For SQL Server, provide the SQL Server instance name. Case-sensitive or binary collation SQL Server instances are not supported.</para>
        ///   <para>For Oracle, provide either the TNS name or the Oracle Easy Connection string.</para>
        ///   <para>For PostgreSQL, provide the name of the server where PostgreSQL is installed.</para>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>实例的名称。</para>
        ///   <para>对于 SQL Server，请提供 SQL Server 实例名称。不支持区分大小写或二进制排序规则的 SQL Server 实例。</para>
        ///   <para>对于 Oracle，请提供 TNS 名称或 Oracle Easy Connection 字符串。</para>
        ///   <para>对于 PostgreSQL，请提供安装 PostgreSQL 的服务器的名称。</para>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Instance")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public object _instance_name { get; set; }


        /// <summary>
        /// <para>Database</para>
        /// <para><xdoc>
        ///   <para>The name of the database.</para>
        ///   <para>This parameter is valid for PostgreSQL and SQL Server. You can provide either the name of an existing, preconfigured database or a name for a database that the tool will create.</para>
        ///   <para>If the tool creates the database in SQL Server, the file sizes will either be the same as defined for the SQL Server model database or 500 MB for the MDF file and 125 MB for the LDF file, whichever is greater. Both the MDF and LDF files are created in the default SQL Server location on the database server. Do not name the database sde.</para>
        ///   <para>If the tool creates the database in PostgreSQL, it uses the template1 database as the template for your database. If you need a different template—for example, you require a template that is enabled for a PostGIS—you must create the database before running this tool and provide the name of the existing database. Always use lowercase characters for the database name. If you use uppercase letters, the tool will convert them to lowercase.</para>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>数据库的名称。</para>
        ///   <para>此参数对 PostgreSQL 和 SQL Server 有效。您可以提供现有预配置数据库的名称，也可以提供该工具将创建的数据库的名称。</para>
        ///   <para>如果该工具在 SQL Server 中创建数据库，则文件大小将与为 SQL Server 模型数据库定义的文件大小相同，MDF 文件为 500 MB，LDF 文件为 125 MB，以较大者为准。MDF 和 LDF 文件都是在数据库服务器上的默认 SQL Server 位置创建的。不要将数据库命名为 sde。</para>
        ///   <para>如果该工具在 PostgreSQL 中创建数据库，则使用 template1 数据库作为数据库的模板。如果需要其他模板（例如，需要为 PostGIS 启用的模板），则必须在运行此工具之前创建数据库并提供现有数据库的名称。始终使用小写字符作为数据库名称。如果您使用大写字母，该工具会将它们转换为小写字母。</para>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Database")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public object _database_name { get; set; } = null;


        /// <summary>
        /// <para>Operating System Authentication</para>
        /// <para><xdoc>
        ///   <para>Specifies the type of authentication that will be used for the database connection.
        ///   <bulletList>
        ///     <bullet_item>Checked—Operating system authentication will be used. The login information that you provide for the computer where you run the tool is the login that will be used to authenticate the database connection. If your database management system is not configured to allow operating system authentication, authentication will fail.  </bullet_item><para/>
        ///     <bullet_item>Unchecked—Database authentication will be used. You must provide a valid database user name and password for authentication in the database. This is the default. If your database management system is not configured to allow database authentication, authentication will fail.  </bullet_item><para/>
        ///   </bulletList>
        ///   </para>
        /// </xdoc></para>
        /// <para><xdoc>
        /// <para>指定将用于数据库连接的身份验证类型。
        ///   <bulletList>
        ///     <bullet_item>选中 - 将使用操作系统身份验证。您为运行该工具的计算机提供的登录信息是将用于验证数据库连接的登录名。如果数据库管理系统未配置为允许操作系统身份验证，则身份验证将失败。 </bullet_item><para/>
        ///     <bullet_item>未选中 - 将使用数据库身份验证。您必须提供有效的数据库用户名和密码才能在数据库中进行身份验证。这是默认设置。如果数据库管理系统未配置为允许数据库身份验证，则身份验证将失败。 </bullet_item><para/>
        ///   </bulletList>
        ///   </para>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Operating System Authentication")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public _account_authentication_value _account_authentication { get; set; } = _account_authentication_value._false;

        public enum _account_authentication_value
        {
            /// <summary>
            /// <para>OPERATING_SYSTEM_AUTH</para>
            /// <para></para>
            /// <para></para>
            /// </summary>
            [Description("OPERATING_SYSTEM_AUTH")]
            [GPEnumValue("true")]
            _true,

            /// <summary>
            /// <para>DATABASE_AUTH</para>
            /// <para></para>
            /// <para></para>
            /// </summary>
            [Description("DATABASE_AUTH")]
            [GPEnumValue("false")]
            _false,

        }

        /// <summary>
        /// <para>Database Administrator</para>
        /// <para>If you use database authentication, specify a database administrator user. For Oracle, use the sys user. For PostgreSQL, specify a user with superuser status. For SQL Server, specify any member of the sysadmin fixed server role.</para>
        /// <para>如果使用数据库身份验证，请指定数据库管理员用户。对于 Oracle，请使用 sys 用户。对于 PostgreSQL，请指定具有超级用户状态的用户。对于 SQL Server，请指定 sysadmin 固定服务器角色的任何成员。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Database Administrator")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public object _database_admin { get; set; } = null;


        /// <summary>
        /// <para>Database Administrator Password</para>
        /// <para>If you use database authentication, provide the password for the database administrator.</para>
        /// <para>如果使用数据库身份验证，请提供数据库管理员的密码。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Database Administrator Password")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public object _database_admin_password { get; set; } = null;


        /// <summary>
        /// <para>Sde Owned Schema</para>
        /// <para><xdoc>
        ///   <para>This parameter is only active for SQL Server and specifies whether the geodatabase will be created in the schema of the sde user or in the dbo schema in the database. .
        ///   <bulletList>
        ///     <bullet_item>Checked—The geodatabase will be created in the schema of the sde user.  </bullet_item><para/>
        ///     <bullet_item>Unchecked—You must be logged in to the SQL Server instance as a user who is dbo in the instance, and the geodatabase will be created in the dbo schema in the database.  </bullet_item><para/>
        ///   </bulletList>
        ///   </para>
        /// </xdoc></para>
        /// <para><xdoc>
        /// <para>此参数仅对 SQL Server 处于活动状态，并指定是在 sde 用户的方案中还是在数据库的 dbo 方案中创建地理数据库。
        ///   <bulletList>
        ///     <bullet_item>选中 - 将在 sde 用户的方案中创建地理数据库。</bullet_item><para/>
        ///     <bullet_item>未选中 - 您必须以实例中的 dbo 用户身份登录到 SQL Server 实例，并且将在数据库的 dbo 方案中创建地理数据库。</bullet_item><para/>
        ///   </bulletList>
        ///   </para>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Sde Owned Schema")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public _sde_schema_value _sde_schema { get; set; } = _sde_schema_value._true;

        public enum _sde_schema_value
        {
            /// <summary>
            /// <para>SDE_SCHEMA</para>
            /// <para></para>
            /// <para></para>
            /// </summary>
            [Description("SDE_SCHEMA")]
            [GPEnumValue("true")]
            _true,

            /// <summary>
            /// <para>DBO_SCHEMA</para>
            /// <para></para>
            /// <para></para>
            /// </summary>
            [Description("DBO_SCHEMA")]
            [GPEnumValue("false")]
            _false,

        }

        /// <summary>
        /// <para>Geodatabase Administrator</para>
        /// <para><xdoc>
        ///   <para>The name of the geodatabase administrator user.</para>
        ///   <para>If you are using PostgreSQL, this value must be sde. If the sde login role does not exist, this tool will create it and grant it superuser status in the database cluster. If the sde login role exists, this tool will grant it superuser status if it does not already have it. The tool also creates an sde schema in the database and grants usage on the schema to public.</para>
        ///   <para>If you are using Oracle, the value is sde. If the sde user does not exist in the Oracle database, the tool will create it and grant it the privileges required to create and upgrade a geodatabase and disconnect users from the database. If you run this tool in an Oracle 12c or later release database, the tool also grants privileges to allow data imports using Oracle Data Pump. If the sde user exists, the tool will grant these same privileges to the existing user.</para>
        ///   <para>
        ///     <para>Beginning with ArcGIS 10.7 and ArcGIS Pro 2.3, you cannot create user-schema geodatabases in Oracle.</para>
        ///   </para>
        ///   <para>If you are using SQL Server and specified an sde-schema geodatabase, this value must be sde. The tool will create an sde login, database user, and schema and grant it privileges to create a geodatabase and remove connections from the SQL Server instance. If you specified a dbo schema, do not provide a value for this parameter.</para>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>地理数据库管理员用户的名称。</para>
        ///   <para>如果使用的是 PostgreSQL，则此值必须为 sde。如果 sde 登录角色不存在，则此工具将创建该角色，并在数据库集群中授予其超级用户身份。如果 sde 登录角色存在，则此工具将授予其超级用户身份（如果尚未具有）。该工具还会在数据库中创建一个 sde 架构，并将该架构的使用权限授予公众。</para>
        ///   <para>如果您使用的是 Oracle，则该值为 sde。如果 Oracle 数据库中不存在 sde 用户，则该工具将创建该用户并授予其创建和升级地理数据库以及断开用户与数据库连接所需的权限。如果在 Oracle 12c 或更高版本的数据库中运行此工具，则该工具还会授予允许使用 Oracle Data Pump 导入数据的权限。如果 sde 用户存在，则该工具将向现有用户授予这些相同的权限。</para>
        ///   <para>
        ///     <para>从 ArcGIS 10.7 和 ArcGIS Pro 2.3 开始，您无法在 Oracle 中创建用户方案地理数据库。</para>
        ///   </para>
        ///   <para>如果使用的是 SQL Server 并指定了 sde 方案地理数据库，则此值必须为 sde。该工具将创建 sde 登录帐户、数据库用户和方案，并授予其创建地理数据库和从 SQL Server 实例中删除连接的权限。如果指定了 dbo 架构，请不要为此参数提供值。</para>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Geodatabase Administrator")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public object _gdb_admin_name { get; set; } = null;


        /// <summary>
        /// <para>Geodatabase Administrator Password</para>
        /// <para><xdoc>
        ///   <para>The password for the geodatabase administrator user. If the geodatabase administrator user exists in the database management system, the password you provide must match the existing password. If the geodatabase administrator user does not exist, provide a valid database password for the new user. The password must meet the password policy enforced by your database.</para>
        ///   <para>The password is an encrypted string.</para>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>地理数据库管理员用户的密码。如果数据库管理系统中存在地理数据库管理员用户，则您提供的密码必须与现有密码匹配。如果地理数据库管理员用户不存在，请为新用户提供有效的数据库密码。密码必须符合数据库强制执行的密码策略。</para>
        ///   <para>密码是加密字符串。</para>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Geodatabase Administrator Password")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public object _gdb_admin_password { get; set; } = null;


        /// <summary>
        /// <para>Tablespace Name</para>
        /// <para><xdoc>
        ///   <para>The name of the tablespace.</para>
        ///   <para>This parameter is only valid for Oracle and PostgreSQL DBMS types. For Oracle, do one of the following:
        ///   <bulletList>
        ///     <bullet_item>Provide the name of an existing tablespace. This tablespace will be used as the default tablespace for the geodatabase administrator user.  </bullet_item><para/>
        ///     <bullet_item>Provide a valid name for a new tablespace. The tool will create a 400 MB tablespace in the Oracle default storage location and set it as the geodatabase administrator's default tablespace.  </bullet_item><para/>
        ///     <bullet_item>Leave the tablespace blank. The tool will create a 400 MB tablespace named SDE_TBS in the Oracle default storage location. The SDE_TBS tablespace will be set as the geodatabase administrator's default tablespace.  </bullet_item><para/>
        ///   </bulletList>
        ///   </para>
        ///   <para>This tool does not create a tablespace in PostgreSQL. You must either provide the name of an existing tablespace to be used as the database's default tablespace or leave this parameter blank. If you leave the parameter blank, the tool will create a database in the pg_default tablespace.</para>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>表空间的名称。</para>
        /// <para>此参数仅对 Oracle 和 PostgreSQL DBMS 类型有效。对于 Oracle，请执行下列操作之一：
        ///   <bulletList>
        ///     <bullet_item>提供现有表空间的名称。此表空间将用作地理数据库管理员用户的默认表空间。 </bullet_item><para/>
        ///     <bullet_item>为新表空间提供有效的名称。该工具将在 Oracle 默认存储位置创建一个 400 MB 的表空间，并将其设置为地理数据库管理员的默认表空间。 </bullet_item><para/>
        ///     <bullet_item>将表空间留空。该工具将在 Oracle 默认存储位置创建一个名为 SDE_TBS 的 400 MB 表空间。SDE_TBS表空间将设置为地理数据库管理员的默认表空间。 </bullet_item><para/>
        ///   </bulletList>
        ///   </para>
        ///   <para>此工具不会在 PostgreSQL 中创建表空间。您必须提供要用作数据库缺省表空间的现有表空间的名称，或者将此参数留空。如果将参数留空，则该工具将在 pg_default 表空间中创建一个数据库。</para>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Tablespace Name")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public object _tablespace_name { get; set; } = null;


        /// <summary>
        /// <para>Authorization File</para>
        /// <para><xdoc>
        ///   <para>The path and file name of the keycodes file that was created when ArcGIS Server was authorized. This file is in the \\Program Files\ESRI\License<release#>\sysgen folder on Windows or the /arcgis/server/framework/runtime/.wine/drive_c/Program Files/ESRI/License<release#>/sysgen directory on Linux. If you have not already done so, authorize ArcGIS Server to create this file.</para>
        ///   <para>You will likely need to copy the keycodes file from the ArcGIS Server machine to a location accessible to the tool.</para>
        /// </xdoc></para>
        /// <para><xdoc>
        /// <para>授权 ArcGIS Server 时创建的密钥代码文件的路径和文件名。此文件位于 Windows 的 \\Program Files\ESRI\License<release#>\sysgen 文件夹中，或者位于 Linux 上的 /arcgis/server/framework/runtime/.wine/drive_c/Program Files/ESRI/License<release#>/sysgen 目录中。如果尚未执行此操作，请授权 ArcGIS Server 创建此文件。</para>
        ///   <para>您可能需要将密钥代码文件从 ArcGIS Server 计算机复制到该工具可访问的位置。</para>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Authorization File")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public object _authorization_file { get; set; }


        /// <summary>
        /// <para>Create Enterprise Geodatabase Succeeded</para>
        /// <para></para>
        /// <para></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Create Enterprise Geodatabase Succeeded")]
        [Description("")]
        [Option(OptionTypeEnum.derived)]
        public object _out_result { get; set; }


        public CreateEnterpriseGeodatabase SetEnv()
        {
            base.SetEnv();
            return this;
        }

    }

}